Various classes of block diagram models describe computations that can be performed on application-specific or general purpose computing hardware, such as a computer, microcontroller, FPGA, and custom hardware. Classes of such block diagram models may include time-based block diagrams such as those found within Simulink® from The MathWorks, Inc. of Natick, Mass., state-based and flow diagrams such as those found within Stateflow® from The MathWorks, Inc. of Natick, Mass., entity-flow network diagrams such as SimEvents from The MathWorks, Inc. of Natick, Mass., and data-flow diagrams. A common characteristic among these various forms of block diagrams is that they define semantics on how to execute the diagram.
Historically, engineers and scientists have utilized time-based block diagram models in numerous scientific areas such as Feedback Control Theory and Signal Processing to study, design, debug, and refine dynamic systems. Dynamic systems, which are characterized by the fact that their behaviors change over time, are representative of many real-world systems. Time-based block diagram modeling has become particularly attractive over the last few years with the advent of software packages such as Simulink® from The MathWorks, Inc. Such packages provide sophisticated software platforms with a rich suite of support tools that makes the analysis and design of dynamic systems efficient, methodical, and cost-effective.
The block diagrams are not exclusively used for representing time-based dynamic systems but also for other models of computation. For instance, flow-charts are block diagrams used to capture process flow and are not generally suitable for describing dynamic system behavior. Data flow block diagrams are block diagrams that describe a graphical programming paradigm where the availability of data (often thought of as tokens) is used to initiate the execution of blocks, where a block represents an operation and a line represents execution dependency describing the direction of data flowing between blocks. As used herein, the term block diagrams means time-based block diagrams used in the context of dynamic systems except as otherwise noted.
A time-based block diagram model of a dynamic system is represented schematically as a collection of blocks interconnected by lines that represent signals. A signal represents the input and output of a dynamic system. Each block represents an elemental dynamic system. A line emanating at one block and terminating at another signifies that the output of the first block is an input to the second block. Each distinct input or output on a block is referred to as a port. Signals correspond to the time-varying quantities represented by each line connection and are assumed to have values at each time instant. The source block of a signal writes to the signal at a given time instant when its system equations are solved. The destination blocks of this signal read from the signal when their system equations are being solved. The block diagram includes a plurality of blocks, lines and ports that are interconnected. Those skilled in the art will recognize that the term “blocks” does not refer exclusively to elemental dynamic systems but may also include other modeling elements that aid in readability and modularity of block diagrams.
Put another way, block diagram models are time-based relationships between signals and state variables representative of a dynamic system. The solution (computation of system response) of the model is obtained by evaluating these relationships at discrete instants in time, where time starts at a user-specified “start time” and either ends at a user-specified “stop time” or based on evaluating a criterion that may involve model and system quantities. The discrete instants in time are separated time intervals, defined as the “sample time.” Signals represent quantities that change over time, and these quantities are defined for all points in time between the block diagram's start and stop time when the signal is part of an enabled aspect of the model. The relationships between signals and state variables are defined by sets of equations represented by blocks. These equations define a relationship between the input signals, output signals, state, and time.
In conventional simulation and code generation technology, the sample time(s) of a model cannot be modified during the simulation of a model, and must be specified before the simulation and code generation of the model. Simulation results and generated code are not valid to other systems that have different sample times. In a system running at multiple sample times, a base rate sample time generally refers to a fundamental sample time that is the fastest in the system. Sub-rate sample times refer to the other sample times that are integer multiples of the base sample time. If any of the sample times (base rate or sub-rate sample time) change, the user must re-compile the model to simulate and generate code for the model. Although all sample times must be invariant during simulation and execution of generated code in the conventional technology, sometimes tunable sample times that can be modified during the simulation are needed.